<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let user = {
        name:"lx",
        age:23
    }
    //将对象转为JSON字符串  输出{"name":"lx","age":23}
    console.log(JSON.stringify(user));

    //将JSON字符串转为对象
    console.log(JSON.parse('{"name": "lx", "age": 23}'));
</script>
</body>
</html>